package com.rwdesign.springboot.Waimai.dao;

import com.rwdesign.springboot.Waimai.entity.User;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    int deleteByPrimaryKey(Integer userId);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer userId);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * @Description: 通过电话号码查询用户id
     * @Param:
     * @return:
     * @Author: rystart
     * @Date: 2022/1/29
     */
    Integer selectUserIdByPhonenumber(String phoneNumber);


    /**
     * @Description: 通过电话号码和密码查询用户id
     * @Param:
     * @return:
     * @Author: cdp
     * @Date: 2022/1/29
     */
    Integer selectIdByPhonenumberAndpwd(String userTelephone, String userPassword);


    /**
     * @Description: 通过用户id查询用户名
     * @Param:
     * @return:
     * @Author: cdp
     * @Date: 2022/1/29
     */

    String selectUsernameById(Integer userId);

    /**
     * @Description: 通过用户id更新token值
     * @Param:
     * @return:
     * @Author: cdp
     * @Date: 2022/1/29
     */
    Integer updateTokenById(String Token, Integer userId);

    /**
     * @Description: 用户注册，用户名，电话号码，密码
     * @Param:
     * @return:
     * @Author: rystart
     * @Date: 2022/1/29
     */
    Integer insertUser(Integer userId, String userName, String userPassword, String userTelephone, String userPicture, String isAdmin, String isShoper, String sessionId, Integer shopId);

    /**
     * @Description: 用户注销, 清除token
     * @Param:
     * @return:
     * @Author: cdp
     * @Date: 2022/1/29
     */
    Integer updateTokenByToken(String token);

    /**
     * @Description: 通过token查询用户id
     * @Param:
     * @return:
     * @Author: rystart
     * @Date: 2022/1/30
     */
    Integer selectIdByToken(String userToken);


    /**
     * @Description: 通过userId查询是否为商户，1-是  0-否
     * @Param:
     * @return:
     * @Author: rystart
     * @Date: 2022/2/15
     */
    String selectIsShoperByUserId(Integer userId);

    /**
     * @return
     * @Author chendanping
     * @Description //TODO 新增商铺，关联用户
     * @Date 20:42 2022/3/7
     * @Param
     **/
    Integer updateShopIdByUserId(Integer shopId, Integer userId);


    /**
     * @Author chendanping
     * @Description //TODO 查询用户是否有开店
     * @Date 20:51 2022/3/7
     * @Param
     * @return
     **/
    Integer selectShopIdByUserId(Integer userId);

}